package com.listener.direct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


import java.util.Map;

/**
 * <h3>springboot_rabbitmq_listener</h3>
 * <p></p>
 *
 * @author gdw
 * @since 2024-07-22 17:00:33
 */
@Component
public class RabbitDirectListener {
    private static final Logger log = LoggerFactory.getLogger(RabbitDirectListener.class);

    @RabbitListener(queues = "direct.queue1")
    public void directQueue1(String message) {
        System.out.println("队列一收到消息"+message);
    }
    @RabbitListener(queues = "direct.queue2")
    public void directQueue2(String message) {
        System.out.println("队列二收到消息"+message);
    }
    @RabbitListener(queues = "object.queue")
    public void directQueue3(Map<String, Object> message) {
        log.info("spring 消费者接收到消息:["+message+"]");
        if(true){
            throw  new RuntimeException("故意的");
        }
        log.info("消息处理完成");
    }
}
